package com.xiguaji.tiktok.v1.ins.rank.repository;

import com.xiguaji.tiktok.v1.ins.rank.model.InsRkBloggerAdecMonth;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * InsRkBloggerAdecMonthRepository
 * @author Huangxin
 */
public interface InsRkBloggerAdecMonthRepository extends CrudRepository<InsRkBloggerAdecMonth,Long>,InsRkBloggerAdecMonthExtRepository {

    @Query("select DISTINCT(datecode) from ins_rk_blogger_adec_month where category_name=:category and datecode >=:startDate ORDER BY datecode  DESC limit 0,:size")
    List<Integer> findDateCode(String category, int startDate, int size);

    @Query("SELECT distinct IFNULL(max(create_time),0) FROM `ins_rk_blogger_adec_month` where category_name = :category ")
    long getMaxCreateTime(String category);


}
